import Vue from 'vue'
import App from './App.vue'
import router from './router/index.js'
import base from './assets/base.css';
import slot from './assets/slot.css';
import store from './store/store.js'
import echarts from 'echarts';
import utils from './utils.js'
// import VueAwesomeSwiper from 'vue-awesome-swiper'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import VueCookies from 'vue-cookies';
import './assets/icon/iconfont.css';
import axios from 'axios';
import request from "@/utils/request";
import i18n from './i18n/i18n';
//Google登录
import GSignInButton from 'vue-google-signin-button'
Vue.use(GSignInButton);
// Facebook登录
import FBSignInButton from 'vue-facebook-signin-button'
Vue.use(FBSignInButton)
// vue-cookies配置
import cookies from 'vue-cookies'
Vue.prototype.$cookies = cookies;
// import VueCookie from 'vue-cookie'
// Vue.prototype.$cookie = VueCookie;
//Apple登录
import VueAppleSignin from 'vue-apple-signin';
Vue.use(VueAppleSignin, {
	clientId: 'com.fishnovel.yuwann',//ID
	scope: 'openid name email',//格式参数
	// redirectURI: 'https://pc.fishnovel.com/orangecatpc100/userLogin/appleCallback',//回调地址
	redirectURI:'https://fndevpcserver.yuwann.com/orangecatpc100/userLogin/appleCallback',//线下
	state: '1228',//防止恶意攻击
	nonce: 'NONCE',//保留
	usePopup: true,//启动弹框
});
// import {info} from './api'
// Vue.prototype.$utils = utils;
Vue.prototype.$axios = axios
// Vue.prototype.$info = info
Vue.prototype.$echarts = echarts;
Vue.use(VueCookies)
Vue.use(router)
// Vue.use(VueAwesomeSwiper)
Vue.use(ElementUI);
router.beforeEach((to, from, next) => {
	// if (to.path.indexOf('author/') > -1 || to.path.indexOf('/writerTool') > -1) {
	// 	if (store.state.userInfo.token != null) {
	// 		next()
	// 	} else {
	// 		alert('您还没有登录，请先登录');
	// 		next('/home');
	// 	}
	// }
	// if(store.state.userInfo.token){
	// 	next()
	// }else{
	// 	alert('您还没有登录，请先登录');
	// 		// next('/home');
	// }
	next()
})
Vue.config.productionTip = false

// router.beforeEach((to, from, next) => {
//     document.title = `${to.meta.title} | 橘子猫作者平台`;
//     const role = localStorage.getItem('ms_username');
//     if (!role && to.path !== '/login') {
//         next('/login');
//     } else if (to.meta.permission) {
//         // 如果是管理员权限则可进入，这里只是简单的模拟管理员权限而已
//         role === 'admin' ? next() : next('/403');
//     } else {
//         // 简单的判断IE10及以下不进入富文本编辑器，该组件不兼容
//         if (navigator.userAgent.indexOf('MSIE') > -1 && to.path === '/editor') {
//             Vue.prototype.$alert('vue-quill-editor组件不兼容IE10及以下浏览器，请使用更高版本的浏览器查看', '浏览器不兼容通知', {
//                 confirmButtonText: '确定'
//             });
//         } else {
//             next();
//         }
//     }
// });
new Vue({
	store,
	i18n,
	el: '#app',
	render: h => h(App),
	router
}).$mount('#app')

